<?php

namespace App\Http\Requests\Api\V1\Common\Sms;

use Illuminate\Foundation\Http\FormRequest;

class SendRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'phone'   => 'required|int',
            'method'  => 'required|string|in:login,register'
//            'captcha' => 'required|captcha_api:'.request()->input('key','').',default'
        ];
    }

    public function messages()
    {
        return [
            'captcha.required'    => '请输入验证码',
            'captcha.captcha_api' => '验证码过期或错误'
        ];
    }
}
